package com.sdx.console.spread.service;

import com.ibeetl.admin.core.service.BaseService;
import com.ibeetl.admin.core.util.PlatformException;
import com.sdx.console.spread.dao.ChannelDao;
import com.sdx.console.spread.entity.Channel;
import org.beetl.sql.core.engine.PageQuery;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @ClassName ChannelSetService
 * @Description
 * @Author kangbin
 * @Date 2020/3/24 15:22
 */
@Service
public class ChannelService extends BaseService<Channel> {

    @Resource
    private ChannelDao channelDao;

    public PageQuery<Channel> queryByCondition(PageQuery page) {

        PageQuery ret =  channelDao.queryByCondition(page);
        queryListAfter(ret.getList());
        return ret;
    }

    public void batchDelChannelSet(List<String> idList) {
        try {
            channelDao.batchDelChannelSetByIds(idList);
        } catch (Exception e) {
            throw new PlatformException("批量删除渠道失败", e);
        }
    }
}
